export default function useLogin() {
  return new Promise((resolve, reject) => {
    uni.login({
      provider: 'weixin', //使用微信登录
      success: function (loginRes) {
        uni.request({
          url: `/user/login/${loginRes.code}`,
          method: 'POST',
          success: (res) => {
            console.log(res.data)
            uni.setStorage({ key: 'token', data: res.data.token })
            resolve()
          }
        })
      }
    })
  });
}